package com.dididoctor.patient.Dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.dididoctor.patient.Bean.AppVersion;
import com.dididoctor.patient.Dialog.adapter.BaseDialog;
import com.dididoctor.patient.R;


public class UpdateDialog extends BaseDialog {
    private TextView mTvConfirm, mTvCancel, mTvUpdataContent;
    private Context context;
    private UpdatView view;
    private AppVersion appVersionBean;

    public UpdateDialog(Context context, UpdatView view, AppVersion appVersionBean) {
        super(context);
        this.context = context;
        this.view = view;
        this.appVersionBean = appVersionBean;
        setContentView(R.layout.dialog_update);
        mTvConfirm = (TextView) findViewById(R.id.tv_confirm);
        mTvConfirm.setOnClickListener(this);
        mTvCancel = (TextView) findViewById(R.id.tv_cancel);
        mTvCancel.setOnClickListener(this);
        mTvUpdataContent = (TextView) findViewById(R.id.tv_updata_content);
        mTvUpdataContent.setText(appVersionBean.getDescr());
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_confirm:
                view.update(appVersionBean.getPath());
                dismiss();
                break;
            case R.id.tv_cancel:
                view.unUpDate();
                dismiss();
                break;
            default:
                break;
        }
        super.onClick(v);
    }

}
